import QtQuick 2.12
import QtQuick.Controls 2.5
import QtQuick.Controls.Styles 1.4
import QtQuick.Layouts 1.3
import QtQuick.Window 2.12

//添加样式
Page {
    id: page
    width: 600
    height: 160
    property alias myButton: myButton
    x: 0

    Row {
        width: 488
        height: 20
        RowLayout {

            spacing: 10

            Rectangle {

                color: "#ffffff"
                Layout.preferredHeight: 80
                Layout.preferredWidth: 1
            }

            Column {

                spacing: 5
                MyBasicToolButton {
                    id: openProject
                    svgPath: "qrc:/image/myMenu.svg"
                    showType: AbstractButton.TextBesideIcon
                    toolButtonWidth: 60
                    toolButtonHeight: 20

                    textName: "Undo"
                }

                MyBasicToolButton {
                    id: closeProject
                    svgPath: "qrc:/image/myMenu.svg"
                    showType: AbstractButton.TextBesideIcon
                    toolButtonWidth: 60
                    toolButtonHeight: 20

                    textName: "Redo"
                }
            }

            MyBasicToolButton {
                id: saveProject
                svgPath: "qrc:/image/myMenu.svg"
                textName: "History"

                showType: AbstractButton.TextUnderIcon
                childMenu: historyMenu
                arrow.visible: true
            }

            //自定义菜单
            MyBasicMenu {
                id: historyMenu
                //Action 类似于快捷键功能
                //                Action {
                //                    text: "A222"
                //                    checkable: true
                //                    checked: true
                //                }
                //                Action {
                //                    text: "B"
                //                    checkable: true
                //                    icon.source: "qrc:/image/myMenu.svg"
                //                }
                MyBasicMenuItem {
                    text: "A"
                    icon.source: "qrc:/image/myMenu.svg"
                }
                MyBasicMenuItem {
                    text: "B"
                    icon.source: "qrc:/image/myMenu.svg"
                }

                MyGridToolPopupMenuSeparator {}

                MyBasicMenuItem {
                    text: "C"
                    icon.source: "qrc:/image/myMenu.svg"
                }

                MyBasicMenu {
                    title: "D"
                    MyBasicMenuItem {
                        text: "A"
                        //icon.source: "qrc:/image/myMenu.svg"
                    }
                    MyBasicMenuItem {
                        text: "B"
                    }
                }
            }

            MyBasicToolButton {
                id: saveFiles
                svgPath: "qrc:/image/myMenu.svg"

                textName: "插入"

                showType: AbstractButton.TextUnderIcon
                childMenu: saveFileMenu
                arrow.visible: true
            }

            //自带menu
            Menu {
                id: saveFileMenu
                MenuItem {
                    icon.source: "qrc:/image/myMenu.svg"
                    text: "现有产品"

                    ToolTip {
                        text: "现有产品"
                    }
                }
                MenuItem {
                    icon.source: "qrc:/image/myMenu.svg"
                    text: "现有零件"
                    ToolTip {
                        text: "现有零件"
                    }
                }
                MenuSeparator {}
                MenuItem {
                    icon.source: "qrc:/image/myMenu.svg"
                    text: "现有工程图"
                    ToolTip {
                        text: "现有工程图"
                    }
                }
            }

            MyComboBox {
                id: myComboBox
                x: 180
                y: 10
                model: ["宋体", "微软雅黑", "黑体"]
            }
        }
    }

    MyButton {
        id: myButton
        x: 323
        y: 9
        text: "预览"
    }
}
